<template>
	<view class="container">
		<view class="item _top20" hover-class="active-bg" @tap="openCall">
			<text class="icon cell"></text>
			<text class="txt">电话客服</text>
		</view>
		<!-- #ifdef MP-WEIXIN || MP-TOUTIAO -->
		<button open-type="contact" class="item mybtn _top20" hover-class="active-bg">
			<text class="icon-chat"></text>
			<text class="txt">在线客服</text>
		</button>
		<!-- #endif -->
		<!-- #ifdef MP-ALIPAY -->
		<button class="item mybtn _top20" hover-class="active-bg">
			<contact-button tnt-inst-id="ZOp_4PlE" scene="SCE01197936" color="#999" icon="../../../static/images/mall/mine_def_touxiang_3x.png"/>
			<text class="txt">在线客服</text>
		</button>
		<!-- #endif -->
	</view>
</template>

<script>
	const util = require("@/utils/util.js")
	export default {
		data() {
			return {
				phone: '15209831990'
			}
		},
		onLoad(){
		  let that = this;
		  util.request('index/getTreaty', {
			type: 3
		  }).then(function(res) {
			if (res.code === 0) {
			  that.phone = res.data
			}
		  });
		},
		methods: {
			openCall: function() {
				uni.makePhoneCall({
					phoneNumber: this.phone
				})
			}
		}
	}
</script>

<style>
	page {
		height: 100%;
		width: 100%;
		background: #f4f4f4;
	}

	.container {
		background: #f4f4f4;
		height: auto;
		overflow: hidden;
		width: 100%;
	}

	.container button {
		width: 100%;
	}

	.item {
		background-color: #fff;
		color: #000;
		display: flex;
		align-items: center;
		padding-left: 30rpx;
		padding-right: 30rpx;
		padding-top: 15rpx;
		padding-bottom: 15rpx;
	}

	.mybtn::after {
		border-radius: 0;
		border: 0;
	}

	.mybtn {
		border-radius: 0;
		border: 0;
	}

	.item .icon.cell {
		background-image: url();
		box-sizing: border-box;
		width: 65rpx;
		border: none;
		border-radius: 50%;
		height: 65rpx;
		background-size: 100% 100%;
	}

	.item .icon-chat {
		background-image: url();
		box-sizing: border-box;
		width: 65rpx;
		border: none;
		border-radius: 50%;
		height: 65rpx;
		background-size: 100% 100%;
	}

	.item .txt {
		margin-left: 30rpx;
		font-size: 30rpx;
	}

	.active-bg {
		background-color: #e6e6e6;
	}

	._top20 {
		margin-top: 20rpx;
	}
</style>
